<?php
/**
 * Handles list of venues 
 * 
 * @author Magnus Stoveland <mstoveland@gmail.com>
 */
class VenueList
{
    /**
     * Fetch data
     * 
     * @return array $venues
     */
    function getModel() {
	    $query = "SELECT * FROM venues WHERE active = 1 ORDER BY name";
	    $db = Database::getInstance();
		$result = $db->query($query);
	    while($row = mysql_fetch_array($result)) {
            $venues[] = $row;
	   }
	   return $venues;
    }
    
    function getFestivals() {
	    $query = "SELECT * FROM venues WHERE active = 1 AND type = 'festival' ORDER BY name";
	    $db = Database::getInstance();
		$result = $db->query($query);
	    while($row = mysql_fetch_array($result)) {
            $venues[] = $row;
	   }
	   return $venues;
    }
    
    function getGigs() {
	    $query = "SELECT * FROM venues WHERE active = 1 AND type = 'gig' ORDER BY name";
	    $db = Database::getInstance();
		$result = $db->query($query);
	    while($row = mysql_fetch_array($result)) {
            $venues[] = $row;
	   }
	   return $venues;
    }
}
?>